From: myfreeweb Date: Tue, 19 Jun 2018 14:49:18 +0000 (+0000) Subject: wayland: Use shm_open(SHM_ANON) on FreeBSD X-Git-Tag: archive/raspbian/3.24.39-1+rpi1~1^2~65^2~35^2~13^2 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/success/%22http:/www.example.com/cgi/success?a=commitdiff_plain;h=055c1b2faa2a43a053d80ad3e4aef4a4f4f9ea2e;p=gtk%2B3.0.git wayland: Use shm_open(SHM_ANON) on FreeBSD This functionality is similar to Linux's memfd. It creates anonymous shared memory without touching the filesystem, which allows it to work in Capsicum capability mode (sandbox). --- diff --git a/gdk/wayland/gdkdisplay-wayland.c b/gdk/wayland/gdkdisplay-wayland.c index b4ef4485da..1e00f292d8 100644 --- a/gdk/wayland/gdkdisplay-wayland.c +++ b/gdk/wayland/gdkdisplay-wayland.c @@ -1276,6 +1276,9 @@ open_shared_memory (void) if (force_shm_open) { +#if defined (__FreeBSD__) + ret = shm_open (SHM_ANON, O_CREAT | O_EXCL | O_RDWR | O_CLOEXEC, 0600); +#else char name[NAME_MAX - 1] = ""; sprintf (name, "/gdk-wayland-%x", g_random_int ()); @@ -1286,6 +1289,7 @@ open_shared_memory (void) shm_unlink (name); else if (errno == EEXIST) continue; +#endif } } while (ret < 0 && errno == EINTR);